package 第7场_小白入门赛;

import java.util.Scanner;

public class _03 {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int arr[] = new int[n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = scan.nextInt();
		}
		
		for(int i = 0; i < n; i++) {
			for(int j = i+1; j < n;j++) {
				int temp;
				
				int a = arr[i] % 2;
				int b = arr[j] % 2;
				if(a != b) {
					if(a == 0) {
						temp = arr[i];
						arr[i] = arr[j];
						arr[j] = temp;
					}
				} else {
					if(arr[j] < arr[i]) {
						temp = arr[j];
						arr[j] = arr[i];
						arr[i] = temp;
					}
				}
				
				
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(arr[i] + " ");
		}
		scan.close();
		
	}
}
